/*
 * Amazon Ads API - Sponsored Products
 * Use the Amazon Ads API for Sponsored Products for campaign, ad group, keyword, negative keyword, and product ad management operations. For more information about Sponsored Products, see the [Sponsored Products Support Center](https://advertising.amazon.com/help?entityId=ENTITY3CWETCZD9HEG2#GWGFKPEWVWG2CLUJ). For onboarding information, see the [account setup](setting-up/account-setup) topic.<br/><br/> 
 *
 * The version of the OpenAPI document: 2.0
 * 
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */


package org.openapitools.client.model;

import java.util.Objects;
import java.util.Arrays;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import org.openapitools.client.model.ExpressionType;
import org.openapitools.client.model.State;
import org.openapitools.client.model.TargetingExpressionPredicate;
import org.openapitools.jackson.nullable.JsonNullable;

/**
 * TargetingClause
 */
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2022-04-12T19:05:39.971406+08:00[Asia/Shanghai]")
public class TargetingClause {
  public static final String SERIALIZED_NAME_TARGET_ID = "targetId";
  @SerializedName(SERIALIZED_NAME_TARGET_ID)
  private BigDecimal targetId;

  public static final String SERIALIZED_NAME_CAMPAIGN_ID = "campaignId";
  @SerializedName(SERIALIZED_NAME_CAMPAIGN_ID)
  private BigDecimal campaignId;

  public static final String SERIALIZED_NAME_AD_GROUP_ID = "adGroupId";
  @SerializedName(SERIALIZED_NAME_AD_GROUP_ID)
  private BigDecimal adGroupId;

  public static final String SERIALIZED_NAME_STATE = "state";
  @SerializedName(SERIALIZED_NAME_STATE)
  private State state;

  public static final String SERIALIZED_NAME_EXPRESSION = "expression";
  @SerializedName(SERIALIZED_NAME_EXPRESSION)
  private List<TargetingExpressionPredicate> expression = null;

  public static final String SERIALIZED_NAME_RESOLVED_EXPRESSION = "resolvedExpression";
  @SerializedName(SERIALIZED_NAME_RESOLVED_EXPRESSION)
  private List<TargetingExpressionPredicate> resolvedExpression = null;

  public static final String SERIALIZED_NAME_EXPRESSION_TYPE = "expressionType";
  @SerializedName(SERIALIZED_NAME_EXPRESSION_TYPE)
  private ExpressionType expressionType;

  public static final String SERIALIZED_NAME_BID = "bid";
  @SerializedName(SERIALIZED_NAME_BID)
  private Float bid;


  public TargetingClause targetId(BigDecimal targetId) {
    
    this.targetId = targetId;
    return this;
  }

   /**
   * The target identifier.
   * @return targetId
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The target identifier.")

  public BigDecimal getTargetId() {
    return targetId;
  }


  public void setTargetId(BigDecimal targetId) {
    this.targetId = targetId;
  }


  public TargetingClause campaignId(BigDecimal campaignId) {
    
    this.campaignId = campaignId;
    return this;
  }

   /**
   * The identifier of the campaign to which this target is associated.
   * @return campaignId
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The identifier of the campaign to which this target is associated.")

  public BigDecimal getCampaignId() {
    return campaignId;
  }


  public void setCampaignId(BigDecimal campaignId) {
    this.campaignId = campaignId;
  }


  public TargetingClause adGroupId(BigDecimal adGroupId) {
    
    this.adGroupId = adGroupId;
    return this;
  }

   /**
   * The identifier of the ad group to which this target is associated.
   * @return adGroupId
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The identifier of the ad group to which this target is associated.")

  public BigDecimal getAdGroupId() {
    return adGroupId;
  }


  public void setAdGroupId(BigDecimal adGroupId) {
    this.adGroupId = adGroupId;
  }


  public TargetingClause state(State state) {
    
    this.state = state;
    return this;
  }

   /**
   * Get state
   * @return state
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "")

  public State getState() {
    return state;
  }


  public void setState(State state) {
    this.state = state;
  }


  public TargetingClause expression(List<TargetingExpressionPredicate> expression) {
    
    this.expression = expression;
    return this;
  }

  public TargetingClause addExpressionItem(TargetingExpressionPredicate expressionItem) {
    if (this.expression == null) {
      this.expression = new ArrayList<TargetingExpressionPredicate>();
    }
    this.expression.add(expressionItem);
    return this;
  }

   /**
   * The targeting expression.
   * @return expression
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The targeting expression.")

  public List<TargetingExpressionPredicate> getExpression() {
    return expression;
  }


  public void setExpression(List<TargetingExpressionPredicate> expression) {
    this.expression = expression;
  }


  public TargetingClause resolvedExpression(List<TargetingExpressionPredicate> resolvedExpression) {
    
    this.resolvedExpression = resolvedExpression;
    return this;
  }

  public TargetingClause addResolvedExpressionItem(TargetingExpressionPredicate resolvedExpressionItem) {
    if (this.resolvedExpression == null) {
      this.resolvedExpression = new ArrayList<TargetingExpressionPredicate>();
    }
    this.resolvedExpression.add(resolvedExpressionItem);
    return this;
  }

   /**
   * The resolved targeting expression.
   * @return resolvedExpression
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The resolved targeting expression.")

  public List<TargetingExpressionPredicate> getResolvedExpression() {
    return resolvedExpression;
  }


  public void setResolvedExpression(List<TargetingExpressionPredicate> resolvedExpression) {
    this.resolvedExpression = resolvedExpression;
  }


  public TargetingClause expressionType(ExpressionType expressionType) {
    
    this.expressionType = expressionType;
    return this;
  }

   /**
   * Get expressionType
   * @return expressionType
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "")

  public ExpressionType getExpressionType() {
    return expressionType;
  }


  public void setExpressionType(ExpressionType expressionType) {
    this.expressionType = expressionType;
  }


  public TargetingClause bid(Float bid) {
    
    this.bid = bid;
    return this;
  }

   /**
   * The bid for ads sourced using the target. Targets that do not have bid values in listTargetingClauses will inherit the defaultBid from the adGroup level. This table details the maximum allowable bid (in local currency) for keywords by marketplace: | Marketplace | Currency | Min / Max bid for SP | | --- | --- | --- | | US | USD | 0.02 / 1000 | | CA | CAD | 0.02 / 1000 | | UK | GBP | 0.02 / 1000 | | DE | EUR | 0.02 / 1000 | | FR | EUR | 0.02 / 1000 | | ES | EUR | 0.02 / 1000 | | IT | EUR | 0.02 / 1000 | | JP | JPY | 2.0 / 100000 | | AU | AUD | 0.10 / 1410 | | AE | AED | 0.24 / 184.0 |
   * minimum: 0.02
   * @return bid
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The bid for ads sourced using the target. Targets that do not have bid values in listTargetingClauses will inherit the defaultBid from the adGroup level. This table details the maximum allowable bid (in local currency) for keywords by marketplace: | Marketplace | Currency | Min / Max bid for SP | | --- | --- | --- | | US | USD | 0.02 / 1000 | | CA | CAD | 0.02 / 1000 | | UK | GBP | 0.02 / 1000 | | DE | EUR | 0.02 / 1000 | | FR | EUR | 0.02 / 1000 | | ES | EUR | 0.02 / 1000 | | IT | EUR | 0.02 / 1000 | | JP | JPY | 2.0 / 100000 | | AU | AUD | 0.10 / 1410 | | AE | AED | 0.24 / 184.0 |")

  public Float getBid() {
    return bid;
  }


  public void setBid(Float bid) {
    this.bid = bid;
  }


  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    TargetingClause targetingClause = (TargetingClause) o;
    return Objects.equals(this.targetId, targetingClause.targetId) &&
        Objects.equals(this.campaignId, targetingClause.campaignId) &&
        Objects.equals(this.adGroupId, targetingClause.adGroupId) &&
        Objects.equals(this.state, targetingClause.state) &&
        Objects.equals(this.expression, targetingClause.expression) &&
        Objects.equals(this.resolvedExpression, targetingClause.resolvedExpression) &&
        Objects.equals(this.expressionType, targetingClause.expressionType) &&
        Objects.equals(this.bid, targetingClause.bid);
  }

  private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
    return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get()));
  }

  @Override
  public int hashCode() {
    return Objects.hash(targetId, campaignId, adGroupId, state, expression, resolvedExpression, expressionType, bid);
  }

  private static <T> int hashCodeNullable(JsonNullable<T> a) {
    if (a == null) {
      return 1;
    }
    return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31;
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class TargetingClause {\n");
    sb.append("    targetId: ").append(toIndentedString(targetId)).append("\n");
    sb.append("    campaignId: ").append(toIndentedString(campaignId)).append("\n");
    sb.append("    adGroupId: ").append(toIndentedString(adGroupId)).append("\n");
    sb.append("    state: ").append(toIndentedString(state)).append("\n");
    sb.append("    expression: ").append(toIndentedString(expression)).append("\n");
    sb.append("    resolvedExpression: ").append(toIndentedString(resolvedExpression)).append("\n");
    sb.append("    expressionType: ").append(toIndentedString(expressionType)).append("\n");
    sb.append("    bid: ").append(toIndentedString(bid)).append("\n");
    sb.append("}");
    return sb.toString();
  }

  /**
   * Convert the given object to string with each line indented by 4 spaces
   * (except the first line).
   */
  private String toIndentedString(Object o) {
    if (o == null) {
      return "null";
    }
    return o.toString().replace("\n", "\n    ");
  }

}

